public class Student {
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {

        return age;
    }
//throws Exception
    public void setAge(int age)  {
        if(age>=0&&age<=120){
            this.age=age;
        }else{
            throw new StudentAgeException("年龄范围有误，需要0-120之间");
        }
    }
}
